<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:sec="http://www.springframework.org/security/facelets/tags"
	xmlns:p="http://primefaces.org/ui">

<ui:composition>
	<f:loadBundle basename="br.ucb.musicbay.recursos.messages" var="msg" />
	<div id="menuop">
		<h:form>

			<p:button value="#{msg.inicio}" outcome="/public/home" ajax="false" icon="ui-icon-home" styleClass="buttonMenuLogin"/>
			<p:button value="#{msg.explorar}" outcome="/public/interno/bibliotecaFull" ajax="false" icon="ui-icon-note" styleClass="buttonMenuLogin"/>


			<sec:ifAnyGranted roles="ROLE_ADMIN, ROLE_USER">
				<p:button value="#{msg.biblioteca}" outcome="/restrict/usuarioPage" icon="ui-icon-tag" styleClass="buttonMenuLogin">
					<f:param name="usuario" value="#{contextoManagedBean.userSession.idusuario}" />
				</p:button>
			</sec:ifAnyGranted>			
		</h:form>
	</div>


	<div id="menulogin">
		<h:form>			
			<h:outputLabel
				value="#{contextoManagedBean.userSession.nome} #{contextoManagedBean.userSession.sobrenome}"
				styleClass="fontLog" />

			<sec:ifNotGranted roles="ROLE_ADMIN, ROLE_USER">
				<p:commandButton value="#{msg.login}" action="/public/login" ajax="false" immediate="true"
					styleClass="buttonMenuLogin" icon="ui-icon-locked" />
				<p:commandButton value="#{msg.cadastro}" action="/public/cadastro" ajax="false" immediate="true"
					styleClass="buttonMenuLogin" icon="ui-icon-arrowreturnthick-1-e" />
			</sec:ifNotGranted>

			<sec:ifAnyGranted roles="ROLE_ADMIN">
				<p:commandButton value="#{msg.administrar}" action="/restrict/adminHome" ajax="false"
					styleClass="buttonMenuLogin" icon="ui-icon-gear" />
			</sec:ifAnyGranted>

			<sec:ifAnyGranted roles="ROLE_USER">
				<p:commandButton value="#{msg.editar} #{msg.user}" action="/restrict/usuarioEditar" ajax="false"
					styleClass="buttonMenuLogin" icon="ui-icon-gear" />
			</sec:ifAnyGranted>			
			
			<sec:ifAnyGranted roles="ROLE_ADMIN, ROLE_USER">
				<p:commandButton value="#{msg.sair}"
					onclick="document.location='#{request.contextPath}/j_spring_security_logout'"
					styleClass="buttonMenuLogin" icon="ui-icon-power" />
			</sec:ifAnyGranted>
		</h:form>
	</div>
</ui:composition>
</html>